import sys
sys.path.append(r'C:\Users\zhangjuntao\anaconda3\Lib\site-packages')

from tencentcloud.common import credential
from tencentcloud.common.profile.client_profile import ClientProfile


from  tencentcloud_ecc_v20181213 import ecc_client, models

def correct_essay(secret_id, secret_key, text):
    """调用腾讯云作文批改接口"""
    try:
        cred = credential.Credential(secret_id, secret_key)
        client = ecc_client.EccClient(cred, "ap-guangzhou")
        
        req = models.CorrectMultiImageRequest()
        req.EnglishEssay = text
        req.Score = 100.0
        req.SessionId = "teacher_correction"
        
        return client.CorrectMultiImage(req)
    except Exception as e:
        raise RuntimeError(f"批改服务异常: {str(e)}")

# 使用示例
# result = correct_essay("your-secret-id", "your-secret-key", essay_text)